function out = mappingImage2020B(inputData, xsize, ysize, outputfilename, legendtext, clim, maxlevel, minlevel)


screen = get(0,'ScreenSize');
dimensions = [600 500];
xmin = 1;
xmax = xsize;
ymin = 1;
ymax = ysize;

xi = (xmin:1:xmax);
yi = (ymin:1:ymax);
[xim,yim] = meshgrid(xi,yi);


% coordinates = zeros(ysize, xsize);
% for i=1:length(inputData)
%     tempCor = floor(i/xsize)+1;
%     coordinates(i,2) = tempCor;
%     coordinates(i,1) = i-xsize*(tempCor-1);
%     if(coordinates(i,1) ==0)
%         coordinates(i,1) = xsize;
%         coordinates(i,2) = tempCor-1;
%     end
% end

  
% zim = reshape(inputDataPlot, [xsize, ysize] )'; 
zim = inputData;

size(zim)

hf = figure('Color',[1 1 1],'Position',[screen(3)/2-dimensions(1),screen(4)/2-100,dimensions]);  % center figure
cmap = colormap('jet'); %flipud(colormap('jet'));
h1 = axes('position',[0.0833, 0.1, 0.667, 0.8],'NextPlot','ReplaceChildren','xtick',[],'ytick',[],'visible','off',...
        'color','w','ydir','reverse','DataAspectRatio', [1 1 1],'xlim',[xmin-0.5, xmax+0.5],'ylim',[ymin-0.5,ymax+0.5],'clim', clim, 'parent',hf);
surf(xim,yim,zim,'EdgeColor','none','FaceColor','flat');
caxis(clim)
colormap(cmap);
view(h1,2);

hcba = colorbar('peer',h1);
set(hcba,'position',[0.85 0.11 0.05 0.79]);
title(hcba, legendtext,'fontweight','bold');
set(hcba,'fontweight','bold');

saveas(h1, outputfilename, 'fig') 


out.xim = xim;
out.yim = yim;
out.zim = zim;